#!/bin/bash 
if !command -v pacman >/dev/null 2>&1;then
    echo "Not arch"
    exit 1
fi
if (($EUID!=0));then
    echo "Need root"
    exit 1
fi
cat<<-'EOF' >/tmp/china.mirror
    # China
	Server = http://mirrors.163.com/archlinux/$repo/os/$arch
	Server = http://mirror.lzu.edu.cn/archlinux/$repo/os/$arch
	Server = http://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
	Server = https://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
	Server = http://mirrors.shu.edu.cn/archlinux/$repo/os/$arch
	Server = https://mirrors.shu.edu.cn/archlinux/$repo/os/$arch
	Server = https://mirrors.sjtug.sjtu.edu.cn/archlinux/$repo/os/$arch
	Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
	Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
	Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
	Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
	Server = http://mirrors.xjtu.edu.cn/archlinux/$repo/os/$arch
	Server = https://mirrors.xjtu.edu.cn/archlinux/$repo/os/$arch
	Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch
EOF
cat /tmp/china.mirror /etc/pacman.d/mirrorlist > /tmp/full.mirror
mv /tmp/full.mirror /etc/pacman.d/mirrorlist

